﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
using DAL;
using DBUlitity;

namespace BLL
{
    public class UserMenuBLL
    {
        public static string GetMenuList(string user)
        {
            string jsonStr = "[]";
            List<UserMenu> menuList = UserMenuDAL.GetUserMenuList(user);
            jsonStr = JSONTools.ScriptSerialize<List<UserMenu>>(menuList);
            return jsonStr;
        }

        /// <summary>
        /// 得到权限树
        /// </summary>
        /// <returns></returns>
        public static string GetLimitTree()
        {
            string jsonStr = "[]";
            List<MenuTree> menuList = UserMenuDAL.GetLimitTree();
            jsonStr = JSONTools.ScriptSerialize<List<MenuTree>>(menuList);
            return jsonStr;
        }

        /// <summary>
        /// 新增角色页面  当是客户登录 构造权限树
        /// </summary>
        /// <param name="?"></param>
        /// <returns></returns>
        public static string initRoleLimitByCustomer(string CustomerName)
        {
            string jsonStr = "[]";
            List<MenuTree> menuList = UserMenuDAL.initRoleLimitByCustomer(CustomerName);
            jsonStr = JSONTools.ScriptSerialize<List<MenuTree>>(menuList);
            return jsonStr;
        }
    }
}
